package com.dldata.devtools30.repository.metadata;

import com.dldata.devtools30.entity.DevtModelMetadataTableEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

@Repository
public interface DevtModelMetadataTableDao extends com.dldata.devtools30.repository.BaseRepository<DevtModelMetadataTableEntity,String>, JpaSpecificationExecutor<DevtModelMetadataTableEntity> {
        @Query("select t from DevtModelMetadataTableEntity t order by t.xh")
        public List<DevtModelMetadataTableEntity> getAll();
        
        @Query("select t from DevtModelMetadataTableEntity t where modeltype in (?1) order by t.xh")
        public List<DevtModelMetadataTableEntity> getAll(List<String> modeltype);

        @Query("select t from DevtModelMetadataTableEntity t where  t.typeId like ?1 and modeltype in (?2)  order by t.xh")
        public List<DevtModelMetadataTableEntity> getAll(String typeid, List<String> modeltype);


        @Query("select t from DevtModelMetadataTableEntity t where  t.typeId like ?1 and (t.name like  ?2 or t.code like  ?2) and modeltype in (?3)  order by t.xh")
        public List<DevtModelMetadataTableEntity> getAll(String typeid, String serach, List<String> modeltype);

        @Query("select t from DevtModelMetadataTableEntity t where t.code=?1  and modeltype in (?2)  order by t.xh")
        public List<DevtModelMetadataTableEntity> findByDbTableCode(String tableCode, List<String> modeltype);
        
        @Query("select t from DevtModelMetadataTableEntity t where id in (?1) order by t.xh")
        public List<DevtModelMetadataTableEntity> getAllByIdList(Collection<String> tableIdList);

}
